Add add_repository_collaborator tool for managing repo access#1542
Open
jack-arturo wants to merge 1 commit intogithub:mainfrom
Open
Add add_repository_collaborator tool for managing repo access#1542jack-arturo wants to merge 1 commit intogithub:mainfrom
add_repository_collaborator tool for managing repo access#1542jack-arturo wants to merge 1 commit intogithub:mainfrom
Conversation
This adds a new tool to the repos toolset that enables managing repository collaborators via the GitHub API. The tool supports: - Adding new collaborators with an invitation - Setting permission levels (pull, triage, push, maintain, admin) - Handling cases where the user already has access - Proper error handling for API failures The implementation follows the existing patterns in the codebase and includes comprehensive tests with mocked HTTP responses for all main scenarios.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new add_repository_collaborator tool to the repositories toolset, enabling AI agents to manage repository collaborators programmatically through the GitHub API. The implementation follows established patterns in the codebase and includes comprehensive testing.
- Adds a new MCP tool for adding collaborators to GitHub repositories with configurable permission levels
- Handles multiple API response scenarios including new invitations, existing collaborators, and error cases
- Includes complete test coverage with mocked HTTP responses
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/tools.go | Registers the new AddRepositoryCollaborator tool in the write tools section of the repos toolset |
| pkg/github/repositories.go | Implements the complete tool definition and handler with validation, error handling, and status code interpretation for three response types (created, accepted, no-content) |
| pkg/github/repositories_test.go | Adds comprehensive table-driven tests covering successful invitation, existing collaborator, and API error scenarios with proper mock expectations |
| pkg/github/toolsnaps/add_repository_collaborator.snap | Tool schema snapshot documenting the API surface for the new tool |
| README.md | Updates tool documentation with parameter descriptions for the new collaborator management functionality |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new tool to the repos toolset that enables managing repository collaborators via the GitHub API. The tool supports:
The implementation follows the existing patterns in the codebase and includes comprehensive tests with mocked HTTP responses for all main scenarios.
Closes #1541.
Closes: